#include <stdio.h>
#include <string.h>
#define SIZE 100
int read_line(char str[], int n);
void reverse(char *message);
char msg[SIZE + 1];
int main(void)
{
    printf("Enter a message: ");
    read_line(msg, SIZE);
    reverse(msg);
    printf("Reversal is: %s\n", msg);
    return 0;
}
int read_line(char str[], int n)
{
    int ch, i = 0;
    while((ch = getchar()) != '\n' && ch != EOF)
        if (i < n)
            str[i++] = ch;
    str[i] = '\0';
    return i;
}
void reverse(char *message) 
{
    char tmp;
    for (char *start = message, *end = message - 1 + strlen(message); start < end; start++, end--) {
        tmp = *start;
        *start = *end;
        *end = tmp;
    }
}
